package me.heizi.springboot.students.repositories

import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper
import me.heizi.springboot.students.entities.User
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param
import org.apache.ibatis.annotations.Select

@Mapper
interface UserRepository :BaseMapper<User> {
    @Select("select * from users where display_name = #{usn}")
    fun selectByName(@Param("usn") username:String):User?

    @Select("""select * from users where (display_name = #{usn} or phone =#{usn}) and password = #{psw}""")
    fun exist(@Param("usn") usn:String, @Param("psw") psw:String, ):List<User>
}

